(function(vc){
    vc.extends({
        propTypes: {
           emitChooseAccountWithdrawalApply:vc.propTypes.string,
           emitLoadData:vc.propTypes.string
        },
        data:{
            chooseAccountWithdrawalApplyInfo:{
                accountWithdrawalApplys:[],
                _currentAccountWithdrawalApplyName:'',
            }
        },
        _initMethod:function(){
        },
        _initEvent:function(){
            vc.on('chooseAccountWithdrawalApply','openChooseAccountWithdrawalApplyModel',function(_param){
                $('#chooseAccountWithdrawalApplyModel').modal('show');
                $that._refreshChooseAccountWithdrawalApplyInfo();
                $that._loadAllAccountWithdrawalApplyInfo(1,10,'');
            });
        },
        methods:{
            _loadAllAccountWithdrawalApplyInfo:function(_page,_row,_name){
                var param = {
                    params:{
                        page:_page,
                        row:_row,
                        communityId:vc.getCurrentCommunity().communityId,
                        name:_name
                    }
                };

                //发送get请求
               vc.http.apiGet('accountWithdrawalApply.listAccountWithdrawalApplys',
                             param,
                             function(json){
                                var _accountWithdrawalApplyInfo = JSON.parse(json);
                                $that.chooseAccountWithdrawalApplyInfo.accountWithdrawalApplys = _accountWithdrawalApplyInfo.accountWithdrawalApplys;
                             },function(){
                                console.log('请求失败处理');
                             }
                           );
            },
            chooseAccountWithdrawalApply:function(_accountWithdrawalApply){
                if(_accountWithdrawalApply.hasOwnProperty('name')){
                     _accountWithdrawalApply.accountWithdrawalApplyName = _accountWithdrawalApply.name;
                }
                vc.emit($props.emitChooseAccountWithdrawalApply,'chooseAccountWithdrawalApply',_accountWithdrawalApply);
                vc.emit($props.emitLoadData,'listAccountWithdrawalApplyData',{
                    accountWithdrawalApplyId:_accountWithdrawalApply.accountWithdrawalApplyId
                });
                $('#chooseAccountWithdrawalApplyModel').modal('hide');
            },
            queryAccountWithdrawalApplys:function(){
                $that._loadAllAccountWithdrawalApplyInfo(1,10,$that.chooseAccountWithdrawalApplyInfo._currentAccountWithdrawalApplyName);
            },
            _refreshChooseAccountWithdrawalApplyInfo:function(){
                $that.chooseAccountWithdrawalApplyInfo._currentAccountWithdrawalApplyName = "";
            }
        }

    });
})(window.vc);
